#include "sfx.h"
#include "io.h"
#include "gfx.h"

#ifdef USE_API_IO_WIN32

#include <windows.h>
#include <graphics.h>

static int _sfx_sound_state;

void sfx_init(void)
{
    int state;
    sfx_get_sound_state(&state);
    sfx_set_sound_state(state);
}

const char *sfx_sounds[] =
{
    "sounds/bruit_deplacement_menu.wav",
    "sounds/ENTRE_MENU.wav",
    "sounds/bruit_rebond_balle.wav",
    "sounds/neon.wav",
    "sounds/neonON3.wav",
    "sounds/neonON.wav",
    "sounds/neonON2.wav",
} ;

void sfx_sound_play(SFX_SOUND sound)
{
    if(_sfx_sound_state == 1)
        PlaySound(sfx_sounds[sound], NULL, SND_ASYNC);
}

int sfx_set_sound_state(int stateValue)
{
    _sfx_sound_state = stateValue;
    if(stateValue == 0)
    {
        PlaySound(0, NULL, SND_ASYNC);
    }
    return 0;
}

void sfx_get_sound_state(int *stateValue)
{
    *stateValue = _sfx_sound_state;
}

#endif
